package com.soft.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.soft.entity.Desk;
import com.soft.mapper.DeskMapper;

@RestController
@RequestMapping("/desk")
public class DeskController {
    
    @Autowired
    private DeskMapper deskMapper; // 假设你有一个DeskMapper接口
    
    @GetMapping("/checkExists")
    public String checkDeskExists(Long deskId) {
        if (deskId == null) {
            return "not exists";
        }
        // 查询数据库中是否存在该桌号
        Desk desk = deskMapper.selectById(deskId);
        return desk != null ? "exists" : "not exists";
    }
}